﻿package components{
	
	import events.SelectedSpeachChanged;
	
	import flash.display.MovieClip;
	import flash.events.MouseEvent;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFormat;
	
	
	public class ActiveTopic extends MovieClip {
		
		public var broadcast:Broadcast;
		private var _root:ActivePanel; // parent mc
		
		private var themeTf:TextField;

		public function ActiveTopic(parentMC:ActivePanel,broadcast:Broadcast):void{
			_root = parentMC;
			this.broadcast = broadcast;
			
			themeTf = new TextField();
			themeTf.autoSize = TextFieldAutoSize.LEFT;
			themeTf.selectable = false;
			themeTf.text = broadcast.theme;
			themeTf.x = 10;
			themeTf.y = - 10;
			addChild(themeTf);
			
			addEventListener(MouseEvent.MOUSE_UP, mouseReleasedHandler);
		}
		
		private function mouseReleasedHandler(e:MouseEvent):void {
			_root.speachSelected(broadcast.id);
		}
	}
}
